/**
 * New node file
 */
(function($) {
	
	function _convertNum(value){
		var  resultValue = "";  
		var  power       = "" ;  
		var  number      = new Number(value);
		if(isNaN(number)){
			return false;
		}
		var tempValueStr = new String(value.toLowerCase());
		if(tempValueStr.indexOf('e') != -1){
			var regExp = new RegExp('^(((\\d+.?\\d+)|(\\d+))[Ee]{1}(([-+]{1}\\d+)|(\\d+)))$', 'ig');
			var result = regExp.exec(tempValueStr);
			var resultValue = "";
			var power = "";
			if (result != null){
				resultValue = result[2];
				power = result[5];
				result = regExp.exec(tempValueStr);
			}

			if (resultValue != ""){
				if (power != ""){
					var powVer = Math.pow(10, parseInt(power));
					resultValue = resultValue * powVer;
				}
			}
		}
		return parseFloat(resultValue);
	}
    /** 
     * jQuery EasyUI 1.4 --- 功能扩展 
     *  
     * Copyright (c) 2009-2018 RCM 
     * 
     * 新增 validatebox 校验规则 
     * 
     */  
    $.extend($.fn.validatebox.defaults.rules, {  
        checkNumber: {  
            validator: function(value, param) {
            	if(/^([1-9][0-9]*)$/.test(value)){
            		return true;
            	}
            	if(/^(((\d+.?\d+)|(\d+))[Ee]{1}(\d+))$/.test(value)){
            		var data = _convertNum(value);
            		if(data>0){
            			return /^([1-9][0-9]*)$/.test(data);
            		}
            	}
            	return false;
            },
            message: '请输入大于0的整数值'  
        },
        checkFloat :{
        	validator: function(value, param) { 
        		if(/^[0-9]\d*(\.\d+)?$/.test(value) && value >0){
            		return true;
        		}
        		if(/^(((\d+.?\d+)|(\d+))[Ee]{1}(([-+]{1}(\d+))|(\d+)))$/.test(value)){
        			var data = _convertNum(value);
            		if(data>0){
            			return true;
            		}
        		}
        		return false;
            },  
            message: '请输入大于0的数值'
        } 
    });  
})(jQuery);  
